package com.indusfo.spc.client.controller;

import com.indusfo.spc.annotation.UserLoginToken;
import com.indusfo.spc.client.service.ClientOrderService;
import com.indusfo.spc.pojo.Order;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author chenm
 * @create 2019-12-04 14:31
 */
@RestController
@RequestMapping("/client/order")
public class ClientOrderController {

  @Autowired
  private ClientOrderService clientOrderService;

  /**
   * 查詢订单
  */
  @PostMapping("/list")
  @UserLoginToken
  public JSONObject list(@RequestBody Order order){
    try{
      return clientOrderService.selectList(order);
    }catch (Exception e){
      e.printStackTrace();
      return JSONObject.build(JSONObject.ERROR,"系统出错");
    }
  }

}
